﻿using BlogEngine.Gallery.Data;
using System.Collections.Generic;
using System.Web.Http;

namespace BlogEngine.Gallery.Controllers
{
    public class UploadsController : ApiController
    {
        public IEnumerable<string> Get()
        {
            return Repository.GetUploaded();
        }

        [HttpPost]
        public void ResetCounts()
        {
            try
            {
                Repository.ResetCounts();
                RedirectToRoute("Default", new { controller = "Home", action = "Admin", id = "0" });
            }
            catch (System.Exception)
            {
                RedirectToRoute("Default", new { controller = "Home", action = "Admin", id = "1" });
            }
        }
    }
}
